package com.wxmit.module.system.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.wxmit.base.domain.ApiResult;
import com.wxmit.framework.satoken.core.util.StpUserUtil;
import com.wxmit.framework.web.operatelog.Log;
import com.wxmit.framework.web.operatelog.LogModule;
import com.wxmit.framework.web.operatelog.enums.BusinessType;
import com.wxmit.base.validate.AddGroup;
import com.wxmit.base.validate.UpdateGroup;

import com.wxmit.module.system.domain.SysLoginLog;
import com.wxmit.module.system.domain.vo.LoginLogVO;
import com.wxmit.module.system.service.ISysLoginLogService;
import com.wxmit.system.base.core.ShushanBaseController;
import com.wxmit.system.base.domain.PageDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统访问记录Controller
 * @author xiong
 * @date 2022-08-05
 */
@RestController
@RequestMapping("/system/log")
@LogModule("系统访问记录")
public class SysLoginLogController extends ShushanBaseController<ISysLoginLogService,SysLoginLog,Long> {


    public SysLoginLogController(ISysLoginLogService baseService){
        super(baseService,"system:log:");
    }

    @SaCheckPermission("system:log:remove")
    @Log(module = "系统访问记录",name="清除访问日志数据",  type = BusinessType.DELETE)
    @DeleteMapping("/clear")
    public ApiResult clear(){
        baseService.clear();
       return ApiResult.success();
    }

    @PostMapping("/workBenchLoginLog")
    public List<LoginLogVO> workBenchLoginLog()
    {
        return baseService.workBenchLoginLog();
    }
}